<template>
  <div class="app-container checked">
    <div class="filter-container">
      <el-input v-model.trim="query.query.purchaseOrderNumber" clearable placeholder="请输入订单编号"
        @keyup.enter.native="search" />
      <el-input v-model.trim="query.query.supplierName" clearable placeholder="请输入供应商名称" @keyup.enter.native="search" />
      <el-input v-model.trim="query.query.materialNo" clearable placeholder="请输入物料编号" @keyup.enter.native="search" />
      <el-select v-model="query.query.state" placeholder="请选择订单状态" clearable>
        <el-option v-for="item in orderState" :key="item.value" :label="item.label" :value="item.value">
        </el-option>
      </el-select>
      <el-select v-model="query.query.inStoreState" placeholder="请选择入库状态" clearable>
        <el-option v-for="item in inState" :key="item.value" :label="item.label" :value="item.value">
        </el-option>
      </el-select>
      <!-- <el-date-picker v-model="query.query.demandDate" type="date" :value-format="'timestamp'" placeholder="请选择需求日期">
      </el-date-picker> -->
      <!-- <el-date-picker v-model="q_z_formDate" format="yyyy-MM-dd" value-format="yyyy-MM-dd" type="daterange"
        range-separator="-" start-placeholder="计划交货开始日期" end-placeholder="计划交货结束日期" @change="q_z_selectTime" /> -->
      <el-button type="primary" icon="el-icon-search" @click="search">{{ $t('table.search') }}</el-button>
      <!-- <el-button type="primary" icon="el-icon-download" @click="handleDownload">合同下载</el-button> -->
      <el-button type="primary" icon="el-icon-check" @click="handleGenerate">生成入库单</el-button>
      <el-button type="primary" icon="el-icon-check" @click="handleClickYf">预付提交</el-button>
      <el-button @click="handleExport" type="primary" icon="el-icon-download">
        {{ $t("table.export") }}
      </el-button>
      <!-- <el-button @click="handleCg" type="primary" icon="el-icon-check">
        生成采购收货单
      </el-button> -->
    </div>
    <el-table :data="tableData" highlight-current-row border @selection-change="handleSelectionChange"
      :header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }"
      @cell-click="yfCellClick">
      <el-table-column type="selection" width="55" />
      <el-table-column prop="purchaseOrderNumber" label="订单编号" fixed="left" />
      <!-- <el-table-column prop="createTime" label="创建时间" /> -->
      <el-table-column prop="supplierName" label="供应商名称" width="120" />
      <el-table-column label="物料名称" width="120" prop="materialName" />
      <el-table-column label="需求日期" prop="demandDate" width="100">
        <template slot-scope="{ row }">
          <span>{{ getMoment(row.demandDate) }}</span>
        </template>
      </el-table-column>
      <!-- <el-table-column prop="planDeliverDateBegin" label="计划交期开始时间" />
      <el-table-column prop="planDeliverDateEnd" label="计划交期结束时间" /> -->
      <el-table-column prop="state" label="订单状态">
        <template slot-scope="{row}">
          <span>{{ row.state == 1 ? '新增' : '完成' }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="inStoreState" label="入库状态">
        <template slot-scope="{row}">
          <span>{{ row.inStoreState == '0' ? '未入库' : row.state == '1' ? '部分入库' : '全部入库' }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="orderedQty" label="订单数量" />
      <!-- <el-table-column prop="actualShippedQty" label="发货数量" /> -->
      <!-- <el-table-column prop="sendGoodsDate" label="发货日期" /> -->
      <el-table-column prop="amount" label="含税总价" />
      <el-table-column prop="inStoreGoodsNum" label="入库数量" />
      <el-table-column prop="prepaidPayment" label="预付">
        <template slot-scope="{row:{prepaidPayment}}">
          {{ prepaidPayment ? Math.abs(prepaidPayment) : '' }}
        </template>
        <!-- <template slot-scope="{row}">
          <el-select size="small" v-model="value" filterable placeholder="请选择预付">
            <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select> -->
        <!-- <el-input v-if="!row.prepaidPayment" size="small" v-model.trim="row.prepaidPaymentCopy" clearable @blur="prepaidPaymentBlur($event, row)" />
          <span v-else>{{ row.prepaidPayment }}</span> -->
        <!-- </template> -->
      </el-table-column>
      <el-table-column prop="paymentMethod" label="付款方式" />
      <el-table-column prop="unit" label="单位" />
      <el-table-column prop="invoiceDate" label="付款日期" />
      <el-table-column prop="totalAmount" label="付款金额" />
      <el-table-column prop="invoiceCode" label="开票状态">
        <template slot-scope="{row:{invoiceCode,invoiceDate,invoiceData}}">
          <el-popover placement="top" width="400" trigger="hover" :disabled="!invoiceData || !invoiceData.length">
            <el-table :data="invoiceData">
              <el-table-column width="200" property="invoiceCode" label="发票号"></el-table-column>
              <el-table-column width="200" property="invoiceDate" label="开票日期"></el-table-column>
            </el-table>
            <div slot="reference">{{ invoiceData && invoiceData.length ? '已开票' : '未开票' }}</div>
          </el-popover>
        </template>
      </el-table-column>
      <el-table-column :label="$t('table.actions')" fixed="right" width="400">
        <template slot-scope="{ row, $index }">
          <el-button type="primary" size="mini" @click="handleDetail(row.internalOrderNumber)">详情</el-button>
          <el-button type="primary" size="mini" @click="handleDownload(row.id)">{{
            $t("table.download") }}</el-button>
          <el-button type="danger" size="mini" :disabled="!row.prepaidPayment"
            @click="cancelYf(row.id)">取消预付</el-button>
          <el-button type="danger" size="mini" :disabled="row.state != 1" @click="cancelOrder(row.id)">关闭</el-button>
          <el-button type="danger" size="mini" :disabled="row.prepaidPayment || row.inStoreGoodsNum > 0"
            @click="handleCLick(row.id)">{{
              $t("table.delete") }}</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination v-show="total > 0" :total="total" :page.sync="query.pageIndex" :limit.sync="query.pageSize"
      @pagination="getInfo" />
    <el-dialog width="40%" :close-on-click-modal="false" :visible.sync="detailDialogVisible" title="详细">
      <el-table :data="detailData" row-key="id" highlight-current-row border
        :header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }" ref="multipleTable">
        <el-table-column prop="changeTime" label="入库单时间">
          <template slot-scope="{ row }">
            <span>{{ row.changeTime | parseTime('{y}-{m}-{d} {h}:{i}:{s}') }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="changeNum" label="入库单数量" />
      </el-table>
    </el-dialog>
    <el-dialog title="提示" :visible.sync="dialogVisible" width="500px" @closed="handleClose"
      :close-on-click-modal="false">
      <div>
        <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="80px">
          <el-form-item label="选择合同" prop="templateId">
            <el-select style="width:100%" v-model="ruleForm.templateId" placeholder="请选择合同">
              <el-option v-for="item in tableDataTemp" :key="item.id" :label="item.templateName"
                :value="item.id"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="合同类型" prop="resource">
            <el-radio-group v-model="ruleForm.resource">
              <el-radio label="1">excel</el-radio>
              <el-radio label="2">pdf</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="sure">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog @closed="fundHandleClose" width="70%" :close-on-click-modal="false" :visible.sync="fundDialogVisible"
      title="预付">
      <el-button style="margin-bottom:10px" type="primary" icon="el-icon-plus" @click="handleBind">
        绑定
      </el-button>
      <el-table :data="fundTableData" row-key="id" highlight-current-row border @selection-change="handleSelectionBind"
        :header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }" ref="multipleTable">
        <el-table-column type="selection" width="55" />
        <el-table-column prop="subjectType" label="收入/支出" />
        <el-table-column prop="subjectName" label="科目" />
        <el-table-column prop="price" label="金额" />
        <el-table-column prop="priceCopy" label="使用金额">
          <template slot-scope="{row}">
            <el-input v-model.trim="row.priceCopy" onkeyup="value=value.replace(/[^\-?\d.]/g,'')" placeholder="请输入使用金额"
              clearable />
          </template>
        </el-table-column>
        <el-table-column label="创建人" prop="creator" />
        <el-table-column label="创建时间" prop="createTime" width="160" />
      </el-table>
    </el-dialog>
    <el-dialog title="生成入库单" :visible.sync="generateDialogVisible" width="600px" @closed="generateHandleClose">
      <el-form :model="createInStoreApplyForm" ref="createInStoreApplyForm"
        label-width="80px">
        <el-form-item label="入库单号" prop="createInStoreApply">
          <el-input v-model="createInStoreApplyForm.createInStoreApply" size="small" placeholder="请输入入库单号" />
        </el-form-item>
      </el-form>
      <el-table :data="generateTableData" row-key="id" highlight-current-row border
        :header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }">
        <el-table-column prop="inoutStoreNum" label="入库数量">
          <template slot-scope="{ row, $index }">
            <el-input v-model="row.inoutStoreNum" :disabled="generateId" placeholder="请输入入库数量"
              onkeyup="value=value.replace(/[^\d.]/g,'')" />
          </template>
        </el-table-column>
        <!-- <el-table-column prop="batchNumber" label="批次号">
          <template slot-scope="{ row, $index }">
            <el-input v-model="row.batchNumber" :disabled="generateId" placeholder="请输入批次号" />
          </template>
        </el-table-column> -->
        <el-table-column label="操作" width="120">
          <template slot-scope="{ row, $index }">
            <el-button v-if="$index == 0" type="primary" icon="el-icon-circle-plus-outline" @click="addGenerate"
              circle></el-button>
            <el-button v-if="$index > 0" type="danger" icon="el-icon-remove-outline" circle
              @click="minusGenerate($index)"></el-button>
          </template>
        </el-table-column>
      </el-table>
      <!-- <div>
        <el-form :model="generateRuleForm" :rules="generateRules" ref="generateRuleForm" label-width="80px">
          <el-form-item label="入库数量" prop="inoutStoreNum">
            <el-input v-model="generateRuleForm.inoutStoreNum" placeholder="请输入入库数量"
              onkeyup="value=value.replace(/[^\d.]/g,'')" />
          </el-form-item>
          <el-form-item label="批次号" prop="batchNumber">
            <el-input v-model="generateRuleForm.batchNumber" placeholder="请输入批次号" />
          </el-form-item>
        </el-form>
      </div> -->
      <span slot="footer" class="dialog-footer">
        <el-button @click="generateDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="generateSure">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import { orderPageList, orderDownloadBargain, orderDel, ordersModify, ordersInStoreApply, wmsStoreApplyBatchNumberList, scmOrdersExportExcel, scmOrdersGeneralGoodsReceivedNote, accBuyStatementCount, accAccountDownloadImage } from '@/api/weeklyStoragePlan'
import { accGetYsYf, accBindYsYf, accGetYsYfValue, accCancelYsYf, closeOrder } from '@/api/andonProblemLevel'
import { stockPageList } from '@/api/qmsQualityManagement'
import { templateList } from '@/api/weeklyShipmentPlan'
import waves from '@/directive/waves' // waves directive
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
import { downfile } from '@/utils'
import moment from "moment";

export default {
  name: 'Productionplan',
  components: { Pagination },
  directives: { waves },
  data() {
    return {
      createInStoreApplyRules: {
        createInStoreApply: [
          { required: true, message: '请输入入库单号', trigger: 'blur' }
        ]
      },
      createInStoreApplyForm: {
        createInStoreApply: '',
      },
      detailData: [],
      detailDialogVisible: false,
      options: [],
      orderState: [
        {
          label: '新增',
          value: '1'
        }, {
          label: '完成',
          value: '2'
        }
      ],
      inState: [{
        label: '未入库',
        value: '0'
      }, {
        label: '部分入库',
        value: '1'
      }, {
        label: '全部入库',
        value: '2'
      }],
      q_z_formDate: [],
      type: 1,
      selectedList: [],
      selectedListData: [],
      total: 0,
      query: {
        pageSize: 10,
        pageIndex: 1,
        query: {}
      },
      tableData: [],
      checked: [],
      dialogVisible: false,
      ruleForm: {
        resource: '1'
      },
      rules: {
        templateId: [
          { required: true, message: '请选择合同', trigger: 'change' }
        ],
        resource: [
          { required: true, message: "请选择合同文件类型", trigger: "change" }
        ]
      },
      totalTemp: 0,
      tableDataTemp: [],
      queryTemp: {
        pageSize: 10,
        pageIndex: 1,
        query: {
          templateClassify: '3,4',
          templateName: ''
        }
      },
      orderId: null,
      fundTableData: [],
      selectedListBind: [],
      fundDialogVisible: false,
      generateDialogVisible: false,
      generateTableData: [{
        inoutStoreNum: '',
        batchNumber: ''
      }],
      generateRules: {
        inoutStoreNum: [
          { required: true, message: '请输入入库数量', trigger: 'blur' }
        ],
        batchNumber: [
          { required: true, message: "请输入批次号", trigger: "blur" }
        ]
      }
    }
  },
  mounted() {
    this.getInfo()
    this.getTemplateList()
  },
  methods: {
    async yfCellClick(row, column) {
      if (column.property == 'prepaidPayment' && row.prepaidPayment) {
        try {
          const formData = new FormData()
          formData.append('id', row.detailId)
          await accAccountDownloadImage(formData)
        } catch (err) {
          const format = err.type.split('/')[1]
          const reader = new FileReader();
          reader.readAsText(err);
          reader.onload = (event) => {
            const resultString = reader.result; // 这里就是转换后的字符串
            if (resultString.includes('code') && resultString.includes('isSuccess')) {
              this.$message.error(JSON.parse(resultString).message)
            } else {
              downfile(`水单.${format}`, err);
            }
          }
        }
      }
    },
    async handleExport() {
      try {
        const { query } = this.query
        await scmOrdersExportExcel(query)
      } catch (err) {
        const reader = new FileReader();
        reader.readAsText(err);
        reader.onload = (event) => {
          const resultString = reader.result; // 这里就是转换后的字符串
          if (resultString.includes('code') && resultString.includes('isSuccess')) {
            this.$message.error(JSON.parse(resultString).message)
          } else {
            downfile('采购订单.xlsx', err);
          }
        }
      }
    },
    generateHandleClose() {
      this.generateTableData = [{
        inoutStoreNum: '',
        batchNumber: ''
      }]
      this.createInStoreApplyForm.createInStoreApply = ''
      this.$refs['createInStoreApplyForm'].resetFields();
    },
    async handleDetail(internalOrderNumber) {
      const { records } = await stockPageList({
        pageSize: 10,
        pageIndex: 1,
        query: {
          orderNo: internalOrderNumber
        }
      })
      this.detailData = records
      this.detailDialogVisible = true
      // this.generateId = id
      // this.generateTableData = await wmsStoreApplyBatchNumberList(id)
      // this.generateDialogVisible = true
    },
    addGenerate() {
      if (!this.generateTableData[this.generateTableData.length - 1].inoutStoreNum) {
        this.$message.error('请输入入库数量')
        return
      }
      // if (!this.generateTableData[this.generateTableData.length - 1].batchNumber) {
      //   this.$message.error('请输入批次号')
      //   return
      // }
      this.generateTableData.push({
        inoutStoreNum: '',
        batchNumber: ''
      })
    },
    minusGenerate(index) {
      this.generateTableData.splice(index, 1)
    },
    getMoment(day) {
      if (!day) return "";
      return moment(day).format("YYYY-MM-DD");
    },
    async cancelOrder(id) {
      this.$confirm('是否关闭当前订单?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(async () => {
        await closeOrder(id)
        this.getInfo()
        this.$message.success('操作成功！')
      })
    },
    async cancelYf(id) {
      this.$confirm('此操作将取消预付, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(async () => {
        const formData = new FormData()
        formData.append('purchaseOrderId', id)
        const params = new URLSearchParams(formData)
        await accCancelYsYf(params)
        this.getInfo()
        this.$message.success('操作成功！')
      })
    },
    fundHandleClose() {

    },
    async handleBind() {
      if (this.selectedListBind.length > 1) {
        this.$message.warning('只能选择一条订单')
        return
      } else if (!this.selectedListBind.length) {
        this.$message.warning('请至少选择一条订单')
        return
      }
      const find = this.fundTableData.find(type => type.id == this.selectedListBind[0])
      if (Number(find.priceCopy) < Number(find.price) || Number(find.priceCopy) >= 0) {
        this.$message.error('使用金额区间为小于0并且大于金额，请重新输入！')
        return
      }
      const formData = new FormData()
      formData.append('id', this.selectedListBind[0])
      formData.append('price', find.priceCopy)
      formData.append('purchaseOrderId', this.selectedList[0])
      const params = new URLSearchParams(formData)
      await accBindYsYf(params)
      this.getInfo()
      this.$message.success('操作成功！')
      this.fundDialogVisible = false
    },
    handleSelectionBind(e) {
      this.selectedListBind = []
      e.forEach((item) => {
        this.selectedListBind.push(item.id)
      })
    },
    async handleClickYf() {
      if (this.selectedList.length > 1) {
        this.$message.warning('只能选择一条订单')
        return
      } else if (!this.selectedList.length) {
        this.$message.warning('请至少选择一条订单')
        return
      }
      if (this.selectedListData[0].prepaidPaymentCopy) {
        this.$message.warning('该订单已提交过预付，不能重复提交！')
        return
      }
      const formData = new FormData()
      formData.append('partnerId', this.selectedListData[0].supplierId)
      formData.append('subjectName', '预付')
      const params = new URLSearchParams(formData)
      this.fundTableData = await accGetYsYf(params)
      this.fundTableData.forEach(item => {
        this.$set(item, 'priceCopy', item.price)
      })
      this.fundDialogVisible = true
    },
    handleClose() {
      this.ruleForm = {
        resource: '1'
      }
      this.$refs['ruleForm'].resetFields();
    },
    sure() {
      this.$refs['ruleForm'].validate(async (valid) => {
        if (valid) {
          const format = this.ruleForm.resource == '1' ? 'EXCEL' : 'PDF'
          try {
            await orderDownloadBargain(this.orderId, this.ruleForm.templateId, format)
          } catch (err) {
            const reader = new FileReader();
            reader.readAsText(err);
            reader.onload = (event) => {
              const resultString = reader.result; // 这里就是转换后的字符串
              if (resultString.includes('code') && resultString.includes('isSuccess')) {
                this.$message.error(JSON.parse(resultString).message)
              } else {
                const templateName = this.tableDataTemp.find(type => type.id === this.ruleForm.templateId).templateName
                downfile(`${templateName}.${format == 'EXCEL' ? 'xlsx' : 'pdf'}`, err)
                this.dialogVisible = false
              }
            }
          }
        }
      })
    },
    async getTemplateList() {
      const { records, total } = await templateList(this.queryTemp)
      this.tableDataTemp = records
      this.totalTemp = total
    },
    prepaidPaymentBlur(evt, row) {
      this.$confirm(`预付金额${row.prepaidPaymentCopy}, 是否继续?`, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(async () => {
        row.prepaidPayment = row.prepaidPaymentCopy
        await ordersModify(row)
        this.getInfo()
      }).catch(() => {

      });
    },
    async handleCg() {
      if (this.selectedList.length > 1) {
        this.$message.warning('只能选择一条订单')
        return
      } else if (!this.selectedList.length) {
        this.$message.warning('请至少选择一条订单')
        return
      }
      try {
        await scmOrdersGeneralGoodsReceivedNote(this.selectedList[0])
      } catch (err) {
        const reader = new FileReader();
        reader.readAsText(err);
        reader.onload = (event) => {
          const resultString = reader.result; // 这里就是转换后的字符串
          if (resultString.includes('code') && resultString.includes('isSuccess')) {
            this.$message.error(JSON.parse(resultString).message)
          } else {
            downfile(`采购收货单.xlsx`, err)
          }
        }
      }
    },
    async handleGenerate() {
      if (this.selectedList.length > 1) {
        this.$message.warning('只能选择一条订单')
        return
      } else if (!this.selectedList.length) {
        this.$message.warning('请至少选择一条订单')
        return
      }
      this.generateId = null
      this.generateDialogVisible = true
      // this.$prompt('请输入入库数量', '提示', {
      //   confirmButtonText: '确定',
      //   cancelButtonText: '取消',
      //   inputPattern: /^[1-9]\d*$/,
      //   inputErrorMessage: '入库数量必须为正整数'
      // }).then(async ({ value }) => {
      //   await ordersInStoreApply(this.selectedList[0], value)
      //   this.$message.success('操作成功！')
      // })
    },
    async generateSure() {
      this.$refs['createInStoreApplyForm'].validate(async (valid) => {
        if (valid) {
          if (!this.generateTableData[this.generateTableData.length - 1].inoutStoreNum) {
            this.$message.error('请将数据填写完成！')
            return
          }
          await ordersInStoreApply({
            orderId: this.selectedList[0],
            applyVoList: this.generateTableData,
            inStoreNo:this.createInStoreApplyForm.createInStoreApply
          })
          this.$message.success('操作成功！')
          this.generateDialogVisible = false
        }
      })
    },
    handleCLick(id) {
      this.$confirm('确认删除?', '警告', {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(async () => {
        await orderDel(id)
        this.getInfo()
        this.$message.success('删除成功!')
      })
    },
    async handleDownload(id) {
      // if (this.selectedList.length > 1) {
      //   this.$message.warning('只能选择一条订单')
      //   return
      // } else if (!this.selectedList.length) {
      //   this.$message.warning('请至少选择一条订单')
      //   return
      // }
      this.orderId = id
      this.dialogVisible = true
    },
    q_z_selectTime(value1) {
      if (value1) {
        this.query.query.planDeliverDateBegin = value1[0]
        this.query.query.planDeliverDateEnd = value1[1]
      } else {
        this.query.query.planDeliverDateBegin = ''
        this.query.query.planDeliverDateEnd = ''
      }
    },
    handleSelectionChange(e) {
      this.selectedList = []
      this.selectedListData = []
      this.checked = e
      e.forEach((item) => {
        this.selectedList.push(item.id)
        this.selectedListData.push(item)
      })
    },
    async getInfo() {
      const { records, total } = await orderPageList(this.query)
      let ids = []
      records.forEach(item => {
        ids.push(item.id)
      })
      const data = await accBuyStatementCount(ids.join(','))
      console.log(data)
      records.forEach(item => {
        for (let key in data) {
          if (item.id == key) {
            item.totalAmount = data[key].totalAmount;
            item.invoiceDate = data[key].invoiceDate;
            item.paymentMethod = data[key].paymentMethod;
            item.invoiceCode = data[key].invoiceCode;
            item.invoiceData = data[key].invoiceData;
          }
        }
      })
      this.tableData = records
      this.total = total
      // if (records.length) {
      //   const purchaseIds = records.map(item => item.id).join(',')
      //   const formData = new FormData()
      //   formData.append('purchaseIds', purchaseIds)
      //   const params = new URLSearchParams(formData)
      //   const data = await accGetYsYfValue(params)
      //   data.forEach(item => {
      //     try {
      //       records.forEach(i => {
      //         if (item.purchaseOrderId === i.id) {
      //           this.$set(i, 'prepaidPaymentCopy', item.price)
      //           throw new Error()
      //         }
      //       })
      //     } catch (err) {

      //     }
      //   })
      // }
    },
    search() {
      this.query.pageIndex = 1
      this.getInfo()
    }
  }
}
</script>
